window.onload=function(){
    document.getElementById("notice1").className="Hiden";
    document.getElementById("notice2").className="Hiden";
    document.getElementById("notice3").className="Hiden";
    document.getElementById("notice4").className="Hiden";

    //用户代码验证
    function Valusr(usr){
        var USR =/^[a-zA-Z][a-zA-z0-9_]{6,20}?$/;
        return USR.test(usr);
    }
    document.getElementById("usr").onblur=function(){
        var a=document.getElementById("usr").value;
        if(Valusr(a)){
            document.getElementById("notice1").className="Hiden";
        }
        else{
            document.getElementById("notice1").className="Show";
        }
    }

    //年龄验证
    function Valage(age){
        var AGE =/^(?:[1-9][0-9]?|1[01][0-9]|120)$/;
        return AGE.test(age);
    }
    document.getElementById("age").onblur=function(){
        var a=document.getElementById("age").value;
        if(Valage(a)){
            document.getElementById("notice2").className="Hiden";
        }
        else{
            document.getElementById("notice2").className="Show";
        }
    }

    //验证身份证号码
    function ValID(IDcard){
        var ID =/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
        return ID.test(IDcard);
    }
    document.getElementById("idcard").onblur=function(){
        var a=document.getElementById("idcard").value;
        if(ValID(a)){
            document.getElementById("notice3").className="Hiden";
        }
        else{
            document.getElementById("notice3").className="Show";
        }
    }

    //验证邮箱
    function ValEmial(Emial){
        var EMIAL =/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
        return EMIAL.test(Emial);
    }
    document.getElementById("email").onblur=function(){
        var a=document.getElementById("email").value;
        if( ValEmial(a)){
            document.getElementById("notice4").className="Hiden";
        }
        else{
            document.getElementById("notice4").className="Show";
        }
    }
    
}

